<template>
	<view class="home-container">
		<u-swiper
			:list="list"
			indicator
			indicatorMode="line"
			circular
			height="400rpx"
		></u-swiper>
		<view class="nav-container">
			<view class="nav-item flex-column" 
			v-for="item in userList" :key="item.label"
			@click="jumpRoute(item)">
				<image class="nav-icon" src="@/static/mrtx.png" mode=""></image>
				<view class="nav-txt">
					{{item.label}}
				</view>
			</view>
		</view>
		<view class="doc-list">
			<view class="list-content">
				<view class="doc-item flex-between" @click="toDocDetail">
					<image class="doc-pic" src="@/static/login-banner.png"></image>
					<view class="item-main flex-column">
						<view class="doc-title ellipsis-2">
							额外全额我去饿我去饿我去额前额外全额我去饿我去饿我去额前额外全额我去饿我去饿我去额前额外全额我去饿我去饿我去额前
						</view>
						<text class="doc-type">知识科普</text>
						<view class="doc-info flex-between">
							<text class="doc-time">2024-06-11</text>
							<text class="view-txt">312 次</text>
						</view>
					</view>
				</view>
				<view class="doc-item flex-between" @click="toDocDetail">
					<image class="doc-pic" src="@/static/login-banner.png"></image>
					<view class="item-main flex-column">
						<view class="doc-title ellipsis-2">
							额外全额我去饿我去饿我去额前额外全额我去饿我去饿我去额前额外全额我去饿我去饿我去额前额外全额我去饿我去饿我去额前
						</view>
						<text class="doc-type">知识科普</text>
						<view class="doc-info flex-between">
							<text class="doc-time">2024-06-11</text>
							<text class="view-txt">312 次</text>
						</view>
					</view>
				</view>
				<view class="doc-item flex-between" @click="toDocDetail">
					<image class="doc-pic" src="@/static/login-banner.png"></image>
					<view class="item-main flex-column">
						<view class="doc-title ellipsis-2">
							额外全额我去饿我去饿我去额前额外全额我去饿我去饿我去额前额外全额我去饿我去饿我去额前额外全额我去饿我去饿我去额前
						</view>
						<text class="doc-type">知识科普</text>
						<view class="doc-info flex-between">
							<text class="doc-time">2024-06-11</text>
							<text class="view-txt">312 次</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
    
</template>

<script>
	export default {
		data() {
			return {
				userList: [
					{label: '农户', key: 'farmer', disabled: false},
					{label: '村委会', key: 'village', disabled: true},
					{label: '管理员', key: 'administrators', disabled: true},
				],
				list: [
					'https://cdn.uviewui.com/uview/swiper/swiper3.png',
					'https://cdn.uviewui.com/uview/swiper/swiper2.png',
					'https://cdn.uviewui.com/uview/swiper/swiper1.png',
				],
			}
		},
		methods: {
			jumpRoute(item){
				let _self = this
				if(item.disabled) return _self.$attention.noIcon('功能开发中……')
				uni.navigateTo({
					url: '/pages/login/index'
				})
			},
			toDocDetail(){
				uni.navigateTo({
					url: '/pages/appMain/doc-detail'
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	@mixin fontStyle($color, $size, $weight: 500) {
		color: $color;
		font-size: $size;
		font-weight: $weight;
	}
	.home-container{
		min-height: 100vh;
		background-color: #f8f8f8;
		padding-bottom: 30rpx;
		.nav-container{
			display: grid;
			grid-template-columns: repeat(3, 1fr);
			padding: 20rpx 0;
			background-color: #fff;
			.nav-item{
				align-items: center;
			}
			.nav-icon{
				width: 110rpx;
				height: 110rpx;
			}
			.nav-txt{
				margin-top: 16rpx;
				@include fontStyle(#333, 36rpx)
			}
		}
		.doc-list{
			margin-top: 30rpx;
			.list-content{
				.doc-item{
					background-color: #fff;
					padding: 24rpx;
					border-bottom: 1rpx solid #f4f4f5;
					&:last-child{
						border-bottom: none;
					}
					.doc-pic{
						width: 260rpx;
						height: 140rpx;
						border-radius: 8rpx;
					}
					.item-main{
						width: calc(100vw - 340rpx);
						text-align: justify;
						.doc-title{
							line-height: 46rpx;
							@include fontStyle(#333, 36rpx)
						}
						.doc-info{
							margin-top: 10rpx;
							@include fontStyle(#999, 28rpx, 400)
						}
						.doc-type{
							margin-top: 10rpx;
							@include fontStyle(#2b85e4, 28rpx, 400)
						}
					}
				}
			}
		}
	}
</style>
